import Cookies from 'js-cookie'

let CookiesS = {
    set(key, value) {
        Cookies.set(key, value);
    },
    set(key, value, day) {
        Cookies.set(key, value, { expires: day });
    },
    get(key) {
        return Cookies.get(key);
    },
    remove(key) {
        Cookies.remove(key);
    }
}

let localStorageS = {
    set(key, value) {
        localStorage.setItem(key, JSON.stringify(value));
    },
    get(key) {
        return localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : localStorage.getItem(key);
    },
    remove(key) {
        localStorage.removeItem(key);
    }
}

let sessionStorageS = {
    set(key, value) {
        sessionStorage.setItem(key, JSON.stringify(value));
    },
    get(key) {
        return sessionStorage.getItem(key) ? JSON.parse(sessionStorage.getItem(key)) : sessionStorage.getItem(key);
    },
    remove(key) {
        sessionStorage.removeItem(key);
    }
}

export {CookiesS, localStorageS, sessionStorageS}